From 9b354fd057fa19b96c550a18e3488101dabeac60 Mon Sep 17 00:00:00 2001 From: robertl Date: Mon, 3 Nov 2003 14:35:35 +0000 Subject: [PATCH] Add waypoint constructor. --- defs.h | 3 +-- waypt.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/defs.h b/defs.h index 878c42788..5e0a025c6 100644 --- a/defs.h +++ b/defs.h @@ -180,13 +180,12 @@ typedef void (*filter_init) (char const *); typedef void (*filter_process) (void); typedef void (*filter_deinit) (void); -// void fprintdms(FILE *, const coord *, int); - typedef void (*waypt_cb) (const waypoint *); typedef void (*route_hdr)(const route_head *); typedef void (*route_trl)(const route_head *); void waypt_add (waypoint *); waypoint * waypt_dupe (waypoint *); +waypoint * waypt_new(void); void waypt_del (waypoint *); void waypt_free (waypoint *); void waypt_disp_all(waypt_cb); diff --git a/waypt.c b/waypt.c index b29ab9b3c..54c6267f7 100644 --- a/waypt.c +++ b/waypt.c @@ -93,6 +93,20 @@ waypt_del(waypoint *wpt) waypt_ct--; } +/* + * A constructor for a single waypoint. + */ +waypoint * +waypt_new(void) +{ + waypoint *wpt; + + wpt = xcalloc(sizeof (*wpt), 1); + wpt->altitude = unknown_alt; + + return wpt; +} + unsigned int waypt_count(void) { -- 2.30.2